using System;
using System.BusinessObjects.Transactions;
using Blazing.BusinessObjects.Cms;
using NHibernate;
using NHibernate.Criterion;

namespace Blazing.BusinessObjects.Queries
{
    public class QrySearchMenus
    {
        public static ICriteria Query(int siteId, int menuTypeId)
        {
            ICriteria qry = UnitOfWork.CurrentSession.CreateCriteria(typeof(Menu));
            qry.Add(Expression.Eq("MenuType.ID", menuTypeId));
            qry.Add(Expression.Eq("Site.ID", siteId));
            qry.AddOrder(Order.Asc("ID"));

            qry.SetCacheable(true);
            return qry;
        }       
    }
}
